<html>
<head><meta charset="utf-8"><title>cargo metadata and pkgid · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/cargo.20metadata.20and.20pkgid.html">cargo metadata and pkgid</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="179703558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/cargo%20metadata%20and%20pkgid/near/179703558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eonil <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/cargo.20metadata.20and.20pkgid.html#179703558">(Nov 02 2019 at 13:59)</a>:</h4>
<p>Hello, I'm new here to ask a question.</p>
<p><code>cargo metadata</code> returns <code>packages[].id</code> like <code>"sample1 0.1.0 (path+file:///Users/Dev/Workshop/eonil/experiments/rust/sample1)"</code>. I have been thought it is a pkgid, but it was not. Cargo does not accept the id expression as a valid pkgid. You can check this behavior like this. </p>
<div class="codehilite"><pre><span></span>$ cargo build -p &quot;sample1 0.1.0 (path+file:///Users/Dev/Workshop/eonil/experiments/rust/sample1)&quot;
error: cannot parse &#39;///Users/Dev/Workshop/eonil/experiments/rust/sample1)&#39; as a semver
</pre></div>


<p>I am not sure about shell scripting bug, but I believe this code is okay.</p>
<p>It's confusing that <code>package[].id</code> returned by <code>cargo metadata</code> cannot be used as a package identifier on other cargo commands. Is this an intended behavior? Or am I supposed to break the expression to get proper pkgid?</p>



<a name="179703862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/cargo%20metadata%20and%20pkgid/near/179703862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eonil <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/cargo.20metadata.20and.20pkgid.html#179703862">(Nov 02 2019 at 14:07)</a>:</h4>
<p>Here doesn't seem to be a place to ask this kind of question. I'm gonna move this question to user forum. I'm sorry. I can't find delete button.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>